class MinigamePlayerInteraction extends Interaction;

var bool keyPressedUp;
var bool keyPressedDown;
var bool keyPressedLeft;
var bool keyPressedRight;

function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta )
{

    local EnyaraPlayerController PC;
    PC = EnyaraPlayerController(ViewportOwner.Actor);

    if ((Action == IST_Press) && (Key == IK_W || Key == IK_Up)) {
        keyPressedUp = true;
    } else if ((Action == IST_Release) && (Key == IK_W || Key == IK_Up)) {
        keyPressedUp = false;
    }

    if ((Action == IST_Press) && (Key == IK_A || Key == IK_Left)) {
        keyPressedLeft = true;
    } else if ((Action == IST_Release) && (Key == IK_A || Key == IK_Left)) {
        keyPressedLeft = false;
    }

    if ((Action == IST_Press) && (Key == IK_S || Key == IK_Down)) {
        keyPressedDown = true;
    } else if ((Action == IST_Release) && (Key == IK_S || Key == IK_Down)) {
        keyPressedDown = false;
    }

    if ((Action == IST_Press) && (Key == IK_D || Key == IK_Right)) {
        keyPressedRight = true;
    } else if ((Action == IST_Release) && (Key == IK_D || Key == IK_Right)) {
        keyPressedRight = false;
    }

    PC.PlayerAcceleration = vect(0,0,0);
    PC.PlayerPropelFactor = PC.CurrentFlyingVolume.PlayerPropelFactor;

    switch (PC.CurrentFlyingVolume.CameraLocation) {
        case CL_Cinema:
            break;
        case CL_Left:
            if (keyPressedUp) PC.PlayerAcceleration.Z = 1;
            if (keyPressedLeft) PC.PlayerPropelFactor *= 1.5;
            if (keyPressedDown) PC.PlayerAcceleration.Z = -1;
            if (keyPressedRight) PC.PlayerPropelFactor *= 0.5;
            break;
        case CL_Right:
            if (keyPressedUp) PC.PlayerAcceleration.Z = 1;
            if (keyPressedLeft) PC.PlayerPropelFactor *= 0.5;
            if (keyPressedDown) PC.PlayerAcceleration.Z = -1;
            if (keyPressedRight) PC.PlayerPropelFactor *= 1.5;
            break;
        case CL_Front:
            if (keyPressedUp) PC.PlayerAcceleration.Z = 1;
            if (keyPressedLeft) PC.PlayerAcceleration.Y = 1;
            if (keyPressedDown) PC.PlayerAcceleration.Z = -1;
            if (keyPressedRight) PC.PlayerAcceleration.Y = -1;
            break;
        case CL_Behind: default:
            if (keyPressedUp) PC.PlayerAcceleration.Z = 1;
            if (keyPressedLeft) PC.PlayerAcceleration.Y = -1;
            if (keyPressedDown) PC.PlayerAcceleration.Z = -1;
            if (keyPressedRight) PC.PlayerAcceleration.Y = 1;
            break;
    }

    return false;
}

defaultproperties {

    bActive=True

}
